package com.etmvc.model.test;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.et.ar.annotations.Column;
import com.et.ar.annotations.Id;
import com.et.ar.annotations.Length;
import com.et.ar.annotations.Pattern;
import com.et.ar.annotations.Table;
import com.etmvc.core.BaseModel;
@Table(name="t_user")
public class User extends BaseModel{

	@Id private int id;
//	@Pattern(regex="\\w{1,10}",message="user.name.valid")
	@Length(min=1,max=5,message="user.name.length")
	@Column private String name;
	@Column private String pic;
	@Column private String headpic;
	@Column private Integer age;//不要用int，int如果前台为空串会绑定出错
	@Column private Date birthday;
	@Column private Date createtime;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	public Date getCreatetime() {
		return createtime;
	}
	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	private String createtime2;
	public String getCreatetime2() {
		if (createtime!=null) {
			return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createtime);
		}
		return "nothing";
	}
	public String getPic() {
		return pic;
	}
	public void setPic(String pic) {
		this.pic = pic;
	}
	public String getHeadpic() {
		return headpic;
	}
	public void setHeadpic(String headpic) {
		this.headpic = headpic;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
}
